<template>
    <div class="upload">
        <div class="upload-element" @click="upload">1231231231231</div>
    </div>
</template>

<script>
export default {
    methods: {
        upload() {
            uni.chooseImage({
                success: (chooseImageRes) => {
                    const tempFilePaths = chooseImageRes.tempFilePaths;
                    uni.uploadFile({
                        url: "https://www.example.com/upload", //仅为示例，非真实的接口地址
                        filePath: tempFilePaths[0],
                        name: "file",
                        formData: {
                            user: "test",
                        },
                        success: (uploadFileRes) => {
                            console.log(uploadFileRes.data);
                        },
                    });
                },
            });
        },
    },
};
</script>

<style  lang="scss" scoped>
.upload {
}
</style>